/**
 * 
 */
package com.thor.palmmall.rest.chart.converter;

import java.util.ArrayList;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.chart.AMonitorParam;
import com.thor.palmmall.spi.chart.SMonitorParam;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class SMonitorParamConverter implements Converter<AMonitorParam, SMonitorParam> {

  public static SMonitorParamConverter getInstance() {
    if (instance == null)
      instance = new SMonitorParamConverter();
    return instance;
  }

  private static SMonitorParamConverter instance;

  private SMonitorParamConverter() {
  }

  @Override
  public SMonitorParam convert(AMonitorParam source) {
    if (source == null) {
      return null;
    }
    SMonitorParam target = new SMonitorParam();
    target.setDate(source.getDate());
    target.setStores(new ArrayList<String>());
    target.getStores().addAll(source.getStores());
    return target;
  }

}
